home *** CD-ROM | disk | FTP | other *** search
/ IRIX Base Documentation 2002 November / SGI IRIX Base Documentation 2002 November.iso / usr / share / catman / p_man / cat3dm / audio / alSetErrorHandler.z / alSetErrorHandler
Encoding:
Text File  |  2002-10-03  |  4.0 KB  |  133 lines

  1.  
  2.  
  3.  
  4. aaaallllSSSSeeeettttEEEErrrrrrrroooorrrrHHHHaaaannnnddddlllleeeerrrr((((3333ddddmmmm))))                                  aaaallllSSSSeeeettttEEEErrrrrrrroooorrrrHHHHaaaannnnddddlllleeeerrrr((((3333ddddmmmm))))
  5.  
  6.  
  7.  
  8. NNNNAAAAMMMMEEEE
  9.      alSetErrorHandler - establish an alternate audio error handling routine
  10.  
  11. SSSSYYYYNNNNOOOOPPPPSSSSIIIISSSS
  12.      ####iiiinnnncccclllluuuuddddeeee <<<<ddddmmmmeeeeddddiiiiaaaa////aaaauuuuddddiiiioooo....hhhh>>>>
  13.  
  14.      AAAALLLLeeeerrrrrrrrffffuuuunnnncccc aaaallllSSSSeeeettttEEEErrrrrrrroooorrrrHHHHaaaannnnddddlllleeeerrrr((((AAAALLLLeeeerrrrrrrrffffuuuunnnncccc eeeeffffuuuunnnncccc))))
  15.  
  16. PPPPAAAARRRRAAAAMMMMEEEETTTTEEEERRRR
  17.      _e_f_u_n_c       expects a pointer to an error handling routine declared as
  18.                  vvvvooooiiiidddd eeeerrrrrrrroooorrrrffffuuuunnnncccc((((iiiinnnntttt,,,, ccccoooonnnnsssstttt cccchhhhaaaarrrr****,,,, ............))))
  19.  
  20. DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN
  21.      By default, the Audio Library handles errors silently, returning a
  22.      failure code to the caller. aaaallllSSSSeeeettttEEEErrrrrrrroooorrrrHHHHaaaannnnddddlllleeeerrrr((((3333ddddmmmm)))) allows you to install
  23.      an error handling routine which is called in the event of an error in an
  24.      Audio Library call. This error handler can be a function in the
  25.      application or a default error handler provided by the AL.
  26.  
  27.      Two special values are accepted for _e_f_u_n_c. If _e_f_u_n_c is 0, errors are
  28.      handled silently and no error handler is called. This is the default
  29.      behavior. If _e_f_u_n_c is AL_PRINT_ERRORS, the AL installs a simple internal
  30.      error handler which prints a message to stderr.  This was the default
  31.      behavior in older versions of the AL. If _e_f_u_n_c is neither of these
  32.      values, it is assumed to be a pointer to a function provided by the
  33.      caller.
  34.  
  35.      The arguments that are passed to the error handling routine are an error
  36.      code and a printf-like string perhaps followed with printf-like
  37.      arguments.
  38.  
  39.      The returned value is a pointer to the previous value of _e_f_u_n_c.
  40.  
  41. EEEEXXXXAAAAMMMMPPPPLLLLEEEE
  42.           #include <dmedia/audio.h>
  43.  
  44.           static void
  45.           myerror(int code, const char* fmt, ...)
  46.           {
  47.               /* do something with code */
  48.           }
  49.  
  50.           void example()
  51.           {
  52.               ALerrfunc originalErrorHandler;
  53.               ...
  54.  
  55.               /* set up myerror as the error handler */
  56.               originalErrorHandler = alSetErrorHandler(myerror);
  57.  
  58.               /* do some audio stuff here */
  59.  
  60.  
  61.  
  62.  
  63.                                                                         PPPPaaaaggggeeee 1111
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70. aaaallllSSSSeeeettttEEEErrrrrrrroooorrrrHHHHaaaannnnddddlllleeeerrrr((((3333ddddmmmm))))                                  aaaallllSSSSeeeettttEEEErrrrrrrroooorrrrHHHHaaaannnnddddlllleeeerrrr((((3333ddddmmmm))))
  71.  
  72.  
  73.  
  74.               alSetErrorHandler(originalErrorHandler);
  75.               /* back to normal behavior: errors are ignored */
  76.  
  77.               ...
  78.           }
  79.  
  80.  
  81.  
  82. SSSSEEEEEEEE AAAALLLLSSSSOOOO
  83.      stdarg(5)
  84.  
  85.  
  86.  
  87.  
  88.  
  89.  
  90.  
  91.  
  92.  
  93.  
  94.  
  95.  
  96.  
  97.  
  98.  
  99.  
  100.  
  101.  
  102.  
  103.  
  104.  
  105.  
  106.  
  107.  
  108.  
  109.  
  110.  
  111.  
  112.  
  113.  
  114.  
  115.  
  116.  
  117.  
  118.  
  119.  
  120.  
  121.  
  122.  
  123.  
  124.  
  125.  
  126.  
  127.  
  128.  
  129.                                                                         PPPPaaaaggggeeee 2222
  130.  
  131.  
  132.  
  133.